package org.gc.webapp.util.page;

import java.util.List;

import org.displaytag.pagination.PaginatedList;
import org.displaytag.properties.SortOrderEnum;

public class PageList<T> implements PaginatedList {
    /**
     * 每页的列表
     */
    private List<T> list;
    
    /**
     * 总记录数
     */
    private int fullListSize = 0;
    
    /**
     * 当前页码
     */
    private int pageNumber = 1;

    /**
     * 每页记录数 page size
     */
    private int objectsPerPage = PageUtil.defaultPageSize;

    private String sortCriterion;

    private SortOrderEnum sortDirection;

    private String searchId;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getObjectsPerPage() {
        return objectsPerPage;
    }

    public void setObjectsPerPage(int objectsPerPage) {
        this.objectsPerPage = objectsPerPage;
    }

    public int getFullListSize() {
        return fullListSize;
    }

    public void setFullListSize(int fullListSize) {
        this.fullListSize = fullListSize;
    }

    public String getSortCriterion() {
        return sortCriterion;
    }

    public void setSortCriterion(String sortCriterion) {
        this.sortCriterion = sortCriterion;
    }

    public SortOrderEnum getSortDirection() {
        return sortDirection;
    }

    public void setSortDirection(SortOrderEnum sortDirection) {
        this.sortDirection = sortDirection;
    }

    public String getSearchId() {
        return searchId;
    }

    public void setSearchId(String searchId) {
        this.searchId = searchId;
    }
    @SuppressWarnings("unchecked")
    public PageList(PageList pageList){
        this.fullListSize = pageList.getFullListSize();
        
        this.pageNumber = pageList.getPageNumber();

        this.objectsPerPage = pageList.getObjectsPerPage();

        this.sortCriterion = pageList.getSortCriterion();

        this.sortDirection = pageList.getSortDirection();

        this.searchId = pageList.getSearchId();

    }
    public PageList(){
        
    }
}
